
#ifndef __LIBERTY_ENGINE_WINDOWS_H__
#define __LIBERTY_ENGINE_WINDOWS_H__

#include <Liberty3D/Liberty3D.h>
#include <Liberty3D/OpenGL.h>

#include <string>

namespace Liberty { namespace Engine {
    class Window : public std::enable_shared_from_this<Window> {
    public:
        Window();
        virtual ~Window();

#if defined(WIN32) || defined(WIN64)
    protected:
        HWND _hWnd;
        bool _fullScreen;
        int  _bps;
        RECT _windowRect;

#if defined(LIBERTY_OGL)
        int   _pixelFormat;
        HDC   _hDC;
        HGLRC _context;
#endif

    protected:
        void windowStyles(DWORD& dwStyle, DWORD& dwExStyle);
        void ensureContextCreated(bool recreate = false);

    public:
        void ensureCreated(bool recreate = false);
        void show(UINT showCommand);

    public:
        static HINSTANCE hInstance;

    public:
        static void init(HINSTANCE);

    protected:
        static LRESULT CALLBACK Proc(HWND, UINT, WPARAM, LPARAM);

    protected:
        virtual LRESULT handleMessage(HWND, UINT, WPARAM, LPARAM, bool&);
#endif

#if defined(LIBERTY_COCOA)
    protected:
#ifdef __OBJC__
        __strong NSWindow* _window;
#else
        void* _window;
#endif
        void clean();
        
#endif
        
    public:
        void show();
        void hide();

    public:
        void setTitle(const std::string&);
    };
}}

#endif
